Special Purpose Functions

You can define several special purpose functions in your Class Module in addition to the User-Defined Functions that you are creating. The Crystal Reports Formula Editor can look for and process any of the following class methods:

Function UFInitialize: Integer;
Function UFTerminate: Integer;
Procedure UFStartJob (job: Integer)
Procedure UFEndJob (job: Integer)

Be sure to declare the methods in your code exactly as they appear above. If not declared correctly, they will be ignored by Crystal Reports. These methods are completely optional when creating your Delphi Automation Server. They are provided to assist you with the design of your User-Defined Functions.

UFInitialize

This function is called just after the DLL is loaded into memory. Use this function to handle one-time initialization of variables.

Returns a value of 0 (zero) to indicate successful initialization. Any non-zero value indicates initialization failed.

UFTerminate

This function is called just before the DLL is unloaded from memory. Use this function to clean up any allocated memory or other data before unloading the DLL.

Returns a value of 0 (zero) when finished cleaning up memory.

UFStartJob

This procedure is called by Crystal Reports just before User-Defined Functions are evaluated (or reevaluated). The Crystal Reports job number is passed to the function as the only parameter. Use this function to handle any initialization on a per-job basis.

UFEndJob

This procedure is called by Crystal Reports when the current job finishes, which happens when all pages of a report have been generated, before UFStartJob is called again, or before UFTerminate is called. This function also accepts the Crystal Reports job number as its only parameter. Handle any clean-up necessary on a per-job basis using this function.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com